package com.lmds.sprindemo1.mq;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * User: mgm
 * Date: 2019-08-22
 * Time: 11:19
 */
@Service
public class MessageCustomer {

    @JmsListener(destination = "hello.queue")
    public void receiveMsg(String text) {
        System.err.println("Customer1 recive msg:" + text);
    }

    @JmsListener(destination = "hello.queue")
    public void receiveMsg1(String text) {
        System.err.println("Customer2 recive msg:" + text);
    }

    @JmsListener(destination = "hello.queue")
    public void receiveMsg2(String text) {
        System.err.println("Customer3 recive msg:" + text);
    }

    @JmsListener(destination = "topic.queue", containerFactory = "topicContainerFactory")
    public void subscribe(String text) {
        System.err.println("subscribe1 topic msg:" + text);
    }

    @JmsListener(destination = "topic.queue", containerFactory = "topicContainerFactory")
    public void subscribe1(String text) {
        System.err.println("subscribe2 topic msg:" + text);
    }

    @JmsListener(destination = "topic.queue", containerFactory = "topicContainerFactory")
    public void subscribe2(String text) {
        System.err.println("subscribe3 topic msg:" + text);
    }
}
